const BASE_URL = 'https://huntwolf.top'
// const BASE_URL = 'http://192.168.137.116:8888'

export const request = (params) => {

	
	/*加载弹框*/
	uni.showLoading({
	    title:'请稍候...',
	    mask:true
	});
	
    //请求次数
    var reqTime = 0;
    return new Promise(((resolve, reject) => {
        reqTime++;       
        uni.request({
			
           
            ...params,
			url: BASE_URL + params.url,
            success:result => {
                
				resolve(result);


            },

            fail:(err)=>{
                reject(err);
            },
            complete:() => {
                // console.log("调用了request方法-request.js");
                reqTime--;
                if (!reqTime){
                    uni.hideLoading();
                }
            }
        });


    }))
}